POKE
POKE_W
POKE_L

Syntax: POKE address,value  address=0,1,2,3,...
                            value=0..255
    or: POKE address, value1 {,value}
        (Minerva and SMS only)
    or: POKE address, value | value$ {,value | value$}
        (SMS only)

   and: POKE_W address,value    address=0,2,4,6,...
                                value=-32768..32767
    or: POKE_W address, value1 {,value}
        (Minerva and SMS only)

   and: POKE_L address,value  address=0,2,4,6,...
                              value=-655362/2..655362/2-2
    or: POKE_L address, value1 {,value}
        (Minerva and SMS only)
Location: QL ROM

The POKE commands allow you to set values in memory.

You would generally have already set aside a part of memory for use by your own programs, by using RESPR or ALCHP and then you would POKE different values in that part of memory, eg. for storing data.

Negative values can also be stored in memory. However, they are stored by deducting the number from the maximum number which can be stored in a byte plus one.

POKE 131072,255 and POKE 131072,-1 have the same effect!

Do not try to POKE_W or POKE_L to an odd address (eg. 10001) as this will cause an error unless you are using Minerva (see below).

MINERVA NOTES:
The POKE, POKE_W and POKE_L commands on Minerva (version 1.77 or later) are very much enhanced and different.

Minerva allows you to POKE_W and POKE_L to  odd addresses (eg. POKE_W 131073,100100)

Minerva has also added to the usefulness of the POKE, POKE_W and POKE_L commands by allowing them to store a list of numbers in one go:

POKE_W start,10,125,10322

Minerva also allows the BASIC programmer to access the QL's SuperBASIC variables, system variables and Minerva's own System Xtensions (although the extended PEEKs should be of more use).

The syntax for these extra commands is: 
(1) Alter SuperBASIC variables.
POKE \\SBvar,value      SBvar=0...256
POKE_W \\SBvar,value
POKE_L \\SBvar,value
POKE \SBvar\Offset,value  
POKE_W \SBvar\Offset,value
POKE_L \SBvar\Offset,value

(2) Alter System variables.
POKE !!Sysvar,value     Sysvar=0...1152
POKE_W !!Sysvar,value
POKE_L !!Sysvar,value
POKE !Sysvar!Offset,value
POKE_W !Sysvar!Offset,value
POKE_L !Sysvar!Offset,value

To change the Minerva System Xtensions, use:

SysX=PEEK_L (ver$(-2) + 124)
POKE SysX+offset,value
POKE_W SysX+offset,value
POKE_L SysX+offset,value

Example:
110 LBYTES flp1_new_font,a 
120 POKE_L !124!40,a

SMS Note:
POKE, POKE_W and POKE_L are extended as per Minerva, although odd addresses are still not allowed for POKE_W and POKE_L.

One extra addition to SMS is that the POKE command can actually accept a string as a value to be poked into memory.  If a string is passed as a parameter, each character of the string is converted to its character code and then that byte poked into memory, for example:

POKE base,0,5,'WIN1_'

will store 'WIN1_' as a standard QL string.

Note that if you pass an empty string, this will have no effect.

CROSS-REFERENCE:
PEEK, PEEK_W, PEEK_L and PEEK$ read memory values and POKE$ is another command to set them.
POKES allows you to POKE memory in Supervisor mode.
